﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Subfaculty.Common.Entities;
using Subfaculty.WebApplication.ViewModels;

namespace Subfaculty.WebApplication.Translators
{
    public class StudyLoadTranslator : BaseTranslator<StudyLoad, StudyLoadViewModel>
    {
        public override StudyLoadViewModel Translate(StudyLoad source)
        {
            var studyLoadViewModel = new StudyLoadViewModel();
            List<StudyLoadItemViewModel> slViewItemList = new List<StudyLoadItemViewModel>();

            studyLoadViewModel.Department = source.Department.Title;
            studyLoadViewModel.StudyYear = "с " + source.StudyYear.StartDate + "по " + source.StudyYear.EndDate;

            studyLoadViewModel.StudyLoadItems = new StudyLoadItemTranslator().MakeItems(source.LoadItems, source.StudyYear).ToList();

            return studyLoadViewModel;
        }

    }
}